import { Component, effect, signal } from "@angular/core";
import { TimerDialogService } from "../../services/dialog.service";
import { TuiButton } from "@taiga-ui/core";

@Component({
  selector: 'app-dialog-example',
  imports: [
    TuiButton
  ],
  template: `
    <div>
      <button tuiButton (click)="handleClick()">显示对话框</button>
    </div>
  `,
  standalone: true,
})
export class DialogExampleComponent {
  constructor(private dialogService: TimerDialogService) {


    effect(() => {
      console.log('login', this.login())
      if (this.login() > 1) {
        this.dialogService.showByScenario('app-example', {
          content: '这是一个对话框示例2',
          title: '对话框示例2',
          actions: ['确定', '取消'],
        })?.subscribe()
      }
    })
  }


  login = signal(2)

  handleClick() {
    // this.login.set(2)
    this.login.update(v => v + 1)
  }























}